package com.example.jianzhioffer;

import java.util.ArrayList;

/**
 * Created by Quincy on 2018/9/10.
 *
 * 输入一个链表，按链表值从尾到头的顺序返回一个ArrayList。
 */
public class daozhilianbiao {
    ArrayList<Integer> arrayList = new ArrayList<>();

    public class  ListNode{
        int val;
        ListNode next = null;
        ListNode(int val){
            this.val = val;
        }

    }

    public ArrayList<Integer> printList(ListNode listNode){
        if (listNode != null){
            printList(listNode.next);
            arrayList.add(listNode.val);
        }
        return arrayList;
    }



}
